package com.example.compsedemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.ui.core.Text
import androidx.ui.core.setContent
import androidx.ui.layout.Column
import androidx.ui.material.MaterialTheme
import androidx.ui.material.TopAppBar
import com.example.compsedemo.bean.Article
import com.example.compsedemo.bean.ArticleList
import com.example.compsedemo.bean.User

/**
 *@author: njb
 *@date:  2021/2/6 10:50
 *@desc:
 */
class ComPoseListActivity : AppCompatActivity() {
    val articles = mutableListOf<Article>()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        repeat(11) {
            articles.add(
                Article(
                    id = "$it",
                    title = "JetPack Compose入门",
                    url = "http://www.wanandroid.com/articles/$it",
                    user = User(id = "188", name = "第${it}讲...", profileImageUrl = "")
                )
            )
        }

        setContent {
            MaterialTheme {
                Column {
                    TopAppBar(title = {
                        Text("JetPack Compose入门")
                    })
                    ArticleList(articles = articles)
                }
            }
        }

    }

}